<?php

use yii\helpers\Html;
use yii\grid\GridView;
use common\models\kaoguobao\User;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '用户列表';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="account-wechat-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            'id',
            'user_name',
            'wechat_id',
            'phone',
            [
                'attribute' => 'card_type',
                'value' => function($model) {
                    if (isset($model->card_type)) {
                        return User::$card_type[$model->card_type];
                    }else{
                        return '';
                    }
                },
            ],
            'card_number',
            'birthday:date',
            [
                'attribute' => 'sex',
                'value' => function($model) {
                    if (isset($model->sex)) {
                        return User::$sex[$model->sex];
                    }else{
                        return '';
                    }
                },
            ],
            'mail',
            [
                'attribute' => 'invite_status',
                'value' => function($model) {
                    if (isset($model->invite_status)) {
                        return User::$invite_status[$model->invite_status];
                    }else{
                        return '';
                    }
                },
            ],
            [
                'attribute' => 'invite_id',
                'value' => function($model) {
                    if (empty($model->invite_id)) {
                        return '';
                    }else{
                        return $model->invite_id;
                    }
                },
            ],
            'code',
            'key',
            [
                'attribute' => 'type',
                'value' => function($model) {
                    if (isset($model->type)) {
                        return User::$type[$model->type];
                    }else{
                        return '';
                    }
                },
            ],
            'remarks',
            'created_at:date',
            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

</div>
